<!-- 富文本 -->
<template>
  <view class="rich-wrap">
    <view class="content_box">
      <u-parse :html="richText"></u-parse>
    </view>
  </view>
</template>

<script>
  import Auth from '@/shopro/permission/index.js';
  export default {
    components: {},
    data() {
      return {
        richText: ''
      };
    },
    computed: {},
    onLoad(options) {
      // this.getRichText()
      this.id = options.id;
      console.log(this.$Route.query.id)
      this.getRichText();
    },
    methods: {
      getRichText() {
        if (this.id == 3) {
          this.$http('common.us', {
            // id: this.$Route.query.id
            type: 1
          }).then(res => {
            console.log(res)
            if (res.code == 1) {
				res.data.content = res.data.content.replace(/\/uploads/g,this.$IMG_URL + '/uploads')
				console.log(res.data.content)
              this.richText = res.data.content;
              uni.setNavigationBarTitle({
                title: '关于我们'
              });
            }
          });
        } else {
          if(this.id == 1){
            uni.setNavigationBarTitle({
              title: '隐私协议'
            });
          }else{
            uni.setNavigationBarTitle({
              title: '用户协议'
            });
          }
          this.$http('common.about', {
            type: this.id
          }).then(res => {
            console.log(res)
            if (res.code === 1) {
              this.richText = res.data;
            }
          });
        }
      }
    }
  };
</script>

<style lang="scss">
  .content_box {
    background: #fff;
    padding: 30rpx;
  }
</style>
